
function pointIsInNode(objnode, touchPoint, bMatch)
	local pNode = objnode

	if pNode == nil then
		Misc:log(" obj node is nil!")
		return false
	end

	pNode = tolua.cast(pNode, "CCNode")

	local nodePos = pNode:convertToWorldSpace(CCPoint(0,0))

	local nodeRect = CCRect(0, 0, 0, 0)

	nodeRect.size = pNode:getContentSize()

	local scaleX = pNode:getScaleX()

	local scaleY = pNode:getScaleY()

	local pParent = pNode:getParent()

	while pParent do
		scaleX = scaleX*pParent:getScaleX()
		scaleY = scaleY*pParent:getScaleY()
		pParent = pParent:getParent()
	end

	nodeRect.size.width = nodeRect.size.width * scaleX
	nodeRect.size.height = nodeRect.size.height * scaleY
	nodeRect.origin =  nodePos
	
	local bRet = CCRect:CCRectContainsPoint(nodeRect, touchPoint)
	local matchValue = 0
	if bMatch then
		local x = nodeRect.origin.x + nodeRect.size.width*0.5 - touchPoint.x
		local y = nodeRect.origin.y + nodeRect.size.height*0.5 - touchPoint.y
		matchValue = x*x + y*y
	end
	return bRet, matchValue
end
